<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
 pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="eBrain.beans.Item"%>
<%@page import="eBrain.beans.Bid"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Hashtable"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Enumeration"%>
<jsp:useBean id="dataManager" scope="application"
  class="eBrain.model.DataManager"/>
  
<%String base = (String)application.getAttribute("base"); %>
   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="/eBrain/css/eshop.css" type="text/css"/>
</head>
<body>
<jsp:include page="TopMenu.jsp" flush="true"/>
<jsp:include page="LeftMenu.jsp" flush="true"/>
 
    <form action="<%=base%>?action=storeItem" method="post">
    	<table>
        <tr>
          <td>Name:</td>
          <td>
            <input type="text" name="name"
              value="">
          </td>
        </tr>
        <tr>
          <td>Start:</td>
          <td>
            <input type="text" name="startdate"
               value="">
          </td>
          <td>
            <input type="text" name="starttime"
               value="">
          </td>
        </tr>
        <tr>
          <td>Ende:</td>
          <td>
            <input type="text" name="enddate"
               value="">
          </td>
           <td>
            <input type="text" name="endtime"
               value="">
          </td>
        </tr>
          <tr>
          <td>Start Bid:</td>
          <td>
            <input type="textarea" name="startBid"
               value="">
          </td>
        </tr>
        <tr>
          <td>Description:</td>
          <td>
            <input type="textarea" name="description"
               value="">
          </td>
        </tr>
        <tr>
          <td>Category:</td>
          <td>
          <select id="categoryselect" name="category" onchange="setCategory()">
     	<%
     		Hashtable cats  = dataManager.getAllCategories(); 
     		Enumeration<String> categoryIds = cats.keys();
        while (categoryIds.hasMoreElements()) {
          Object categoryId = categoryIds.nextElement();
     	%>
     	<option value="<%=categoryId.toString()%>"><%=cats.get(categoryId)%></option>
     	<%}%>
          </td>
        </tr>
        
       
        <tr>  
          <td colspan=2>
            <input type="submit" value="Add Item">
          </td>
        </tr>
      </table>
    
     <div>  
     	<font color="red">
      			<%	String msg = (String)request.getAttribute("msg");
      				if(msg!=null){
     					out.print(msg);
     					session.removeAttribute("msg");
      				} %>
   		 </font>
    </div>
    </form>
</body>
</html>